<?php
//  This file is part of EkkinCMS.
//
//  EkkinCMS is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  EkkinCMS is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with EkkinCMS.  If not, see <http://www.gnu.org/licenses/>.

// this plugin installs a autoredirect script on your page. It only works in user mode!

include_once("ext_lib/simple_html_dom.php");
include_once("plugins/link_builder.php");

function execute_autoredirect($site_content){
    $html = str_get_html($site_content);

    foreach($html->find("a") as $element){
        if ($element->class == "ekkin"){
            if ($element->id == "auto_redirect"){
                $link = build_links($element->href);
                if ($admin == 0){
                    $site_head_extra .= "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$link\">";

                }
            }

        }
    }
    return $site_content;
}


?>
